package com.example.proxy.service.impl;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @Description : JDK动态代理
 * @Author : Bruce Lee
 * @CreateTime : 2024/4/10
 */

public class OrderServiceInvocationHandler implements InvocationHandler {

    private Object target;

    public OrderServiceInvocationHandler(Object target) {
        this.target = target;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("Before placing order");
        Object invoke = method.invoke(target, args);
        System.out.println("After placing order");
        return invoke;
    }
}
